<?php include template("header");?>
<script src="/static/jssrc/jquery-1.6.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$('img').filter('.img').click(function(){
		var alt	=	$(this).attr("alt");
		var bank_id	=	$(this).attr("id");
		$('#showinfoofbank').show('slow');
		$('#showbank').html(alt);$('#check').show();
		$('#bank_id_value').val(bank_id);
	})
$('#tttcty').click(function(){ $('#show_tttcty').show('slow'); })
$(document).ready(function(){
	$('input').filter('.ck').click(function(){$('#mycredit').show('slow')});
	$('input').filter('.noneck').click(function(){$('#mycredit').hide('slow');$("#bank_id_value").val(0)});
});
})
</script>
<div id="bdw" class="bdw">
<div id="bd" class="cf">
<div id="content">
    <div id="deal-buy" class="box">
        <div class="box-top"></div>
        <div class="box-content">
            <div class="head"><h2>Đơn hàng số # <?php echo $order['code']; ?></h2></div>
            <div class="sect">
                <table class="order-table">
                    <tr>
                        <th class="deal-buy-desc">Sản phẩm</th>
                        <th class="deal-buy-quantity">Số lượng</th>
                        <th class="deal-buy-multi"></th>
                        <th class="deal-buy-price">Đơn giá/<span class="money"><?php echo $currency; ?><span></th>
                        <th class="deal-buy-equal"></th>
                        <th class="deal-buy-total">Thành tiền/<span class="money"><?php echo $currency; ?><span></th>
                    </tr>
                    <tr>
                        <td class="deal-buy-desc"><?php echo $team['title']; ?></td>
                        <td class="deal-buy-quantity"><?php echo $order['quantity']; ?></td>
                        <td class="deal-buy-multi">x</td>
                        <td class="deal-buy-price" id="deal-buy-price"><?php echo formatMoney($order['price'],0); ?></td>
                        <td class="deal-buy-equal">=</td>
                        <td class="deal-buy-total" id="deal-buy-total"><?php echo formatMoney($order['price']*$order['quantity'],0); ?></td>
                    </tr>
					<?php if($team['delivery']=='express'){?>
					<tr>
						<td class="deal-buy-desc">Phí vận chuyển</td>
						<td class="deal-buy-quantity"></td>
						<td class="deal-buy-multi"></td>
						<td class="deal-buy-price"><span id="deal-express-price"><?php echo formatMoney($team['fare'],0); ?></span></td>
						<td class="deal-buy-equal">=</td>
						<td class="deal-buy-total"><span id="deal-express-total"><?php echo ($team['farefree']==0||$order['quantity']<$team['farefree'])?$team['fare']:0; ?></span></td>
					</tr>
					<?php }?>
					<?php if($order['card']>0){?>
				   <tr id="cardcode-row">
						<td class="deal-buy-desc">card <span id="cardcode-row-n"><?php echo $order['card_id']; ?></span></td>
						<td class="deal-buy-quantity"></td>
						<td class="deal-buy-multi"></td>

						<td class="deal-buy-price"><span class="money"><?php echo $currency; ?></span><?php echo moneyit($order['card']); ?></td>
						<td class="deal-buy-equal">=</td>
						<td class="deal-buy-total">-<span class="money">¥</span><span id="cardcode-row-t"><?php echo $order['card']; ?></span></td>
					</tr>
					<?php }?>

					<tr class="order-total">
                        <td class="deal-buy-desc"><strong>Tổng tiền thanh toán</strong></td>
                        <td class="deal-buy-quantity"></td>
                        <td class="deal-buy-multi"></td>
                        <td class="deal-buy-price"></td>
                        <td class="deal-buy-equal">=</td>
                        <td class="deal-buy-total"><?php echo formatMoney($order['origin'],0); ?></td>
                    </tr>
                </table>
				<div class="paytype">
                <form action="/order/pay.php" method="post" class="validator">
				<div class="order-check-form ">
					<div class="order-pay-credit">
						<h3>Số dư tài khoản</h3>
						<p>Số dư của Bạn là <strong><?php echo moneyit($login_user['money']); ?> <span class="money"><?php echo $currency; ?></span></strong> <?php if(false==$credityes){?> Không đủ để thanh toán đơn hàng này, Bạn cần thanh toán số tiền <strong><?php echo formatMoney($order['origin']-$login_user['money'],0); ?> <span class="money"><?php echo $currency; ?></span></strong> <?php if($creditonly){?>Click <a href="/credit/charge.php">vào đây</a> để nạp tiền ngay。<?php } else { ?> .Vui lòng chọn 1 trong các cách thanh toán bên dưới: <?php }?><?php } else { ?>，Số dư của Bạn đủ thanh toán đơn hàng này, Vui lòng xác nhận giao dịch..<?php }?></p>
						<div class="other_pay"><?php echo $INI['other']['pay']; ?></div>
					</div>  

				<?php if(false==$creditonly && false==$credityes){?>
				<!-- show tất cả cổng thanh toán -->
				<a name="repay"></a>
				<ul class="typelist">
				<?php if(!empty($INI['paypal']['baokim_email'])){?>
					<li><input class="noneck" type="radio" name="paytype" value="bk"><label class="baokim" style="width: 100px;">&nbsp</label><label style="width: 476px;padding: 0px 10px;">Thanh toán dùng Visa, Master Card, ATM, tài khoản có internet banking được hỗ trợ bởi baokim.vn <b class="other_b">***</b></label>
				<?php }?>
				<?php if(!empty($INI['paypal']['nganluong_email'])){?>
					<li><input class="noneck" type="radio" name="paytype" value="nl"><label class="nganluong" style="width: 100px;">&nbsp</label><label style="width: 476px;padding: 0px 10px;">Thanh toán dùng Visa, Master Card, ATM, tài khoản có internet banking được hỗ trợ bởi nganluong.vn <b class="other_b">***</b></label>
				<?php }?>			
					<!-- 2. chuyen khoan/ATM -->
					<li><input class="ck" type="radio" name="paytype" value="ck"><label>Chuyển khoản/ATM <b class="other_b">***</b></label>
					<br><br>
					<div id="mycredit" style="padding-left: 8px;display: none">
					<div id="note">
					Chọn ngân hàng cần chuyển<br>
						<?php if(is_array($banks)){foreach($banks AS $bank=>$showbank) { ?>
						<a href='javascript:'><img alt='Chủ tài khoản: <?php echo $showbank['bankacc']; ?> <?php echo "<Br>"; ?>số tài khoản: <?php echo $showbank['bankcode']; ?> <?php echo "<Br>"; ?>Ngân hàng <?php echo $showbank['bankname_long']; ?>' src='../static/<?php echo $showbank['image']; ?>' id='<?php echo $showbank['id']; ?>' class='img'></img></a>
						<?php }}?>
					</div>
					<div id="showinfoofbank" style="display: none;">
						<img alt="" src="../static/img/icon_check.gif" width="30px" id='check' style="padding-left:  17px">
						<div id='showbank' style="float:right; width: 88%; height: 60px;padding-left:23px;"></div>
					</div>
					</div>
					<!-- end chuyen khoan/ATM -->										
					<!-- 1. thu tại công ty - ct-->
					<li><input id="tttcty" class="noneck" type="radio" name="paytype" value="ct"><label>Thanh toán tại <?php echo $INI['system']['abbreviation']; ?></label><br><br>
					<!-- end thu tại công ty - tien mat -->
					<!-- 3. thu tại nhà khách hàng -->
					<li><input class="noneck" type="radio" name="paytype" value="tn"><label>Thu tiền tại nhà <b class="other_b"><?php if(!empty($INI['other']['phi'])){?>(mất thêm phí <?php echo formatMoney($INI['other']['phi'],0); ?> <?php echo $currency; ?> )<?php }?></b></label>
					<!-- end thu tại nhà khách hàng -->
				</ul>
				<?php } else { ?>
					<input type="hidden" name="paytype" value="credit" />
				<?php }?>
				<?php if($credityes || false==$creditonly){?>
					<div class="clear"></div>
					<p class="check-act">
					<input type="hidden" name="order_id" value="<?php echo $order['id']; ?>" />
					<input type="hidden" name="team_id" value="<?php echo $order['team_id']; ?>" />
					<input type="hidden" name="cardcode" value="" />
					<input type="hidden" name="quantity" value="<?php echo $order['quantity']; ?>" />
					<input type="hidden" name="address" value="<?php echo $order['address']; ?>" />
					<input type="hidden" name="express" value="<?php echo $order['express']; ?>" />
					<input type="hidden" name="remark" value="<?php echo $order['remark']; ?>" />
					<input type="hidden" name="bank_id_value" id="bank_id_value"/>
					<input type="submit" value="Thanh toán" class="formbutton" />
					<?php if(false==$credityes){?>
					<?php }?>
					<input type="button" value="Sửa đơn hàng" class="formbutton" onclick="location.href='/team/buy.php?id=<?php echo $order['team_id']; ?>';" />
					<input type="button" value="Về trang chủ" class="formbutton" onclick="location.href='index.php';" />
				<?php }?>
					</p>
				</div>
				</form>
				</div>
			</div>
		</div>
		<div class="box-bottom"></div>
	</div>
</div>
<div id="sidebar">
<?php if(!$order['card_id']){?>
	<!--{//include block_side_card}-->
	<?php include template("block_side_ask");?>
	<?php include template("block_side_send2group");?>
	<?php include template("block_side_tranfer");?>
<?php }?>
</div>
</div> <!-- bd end -->
</div> <!-- bdw end -->

<?php include template("footer");?>
